package com.fc.mall.orika;

import ma.glasnost.orika.converter.builtin.PassThroughConverter;
import org.joda.time.DateTime;
import org.joda.time.Duration;
import org.joda.time.Instant;
import org.joda.time.Interval;
import org.joda.time.LocalDate;
import org.joda.time.LocalTime;
import org.joda.time.Period;
import org.springframework.beans.factory.config.AbstractFactoryBean;
import org.springframework.stereotype.Component;

@Component
public class JavaTimePassThroughConverterFactoryBean
        extends AbstractFactoryBean<PassThroughConverter> {

    @Override
    public Class<?> getObjectType() {
        return PassThroughConverter.class;
    }

    @Override
    protected PassThroughConverter createInstance() {
        return new PassThroughConverter(
                LocalDate.class, LocalTime.class, DateTime.class,
                Instant.class, Duration.class, Period.class, Interval.class);
    }
}
